{extend name="admin@public/base" /}
{block name="main-content"}
	<div class="page-content">

		<div class="row maintop">
			<div class="col-xs-4 col-sm-2 margintop5">
				<!-- 点击模态框（Modal） -->
				<button class="btn btn-sm btn-danger" data-toggle="modal" data-target="#myModal">
					<i class="ace-icon fa fa-bolt bigger-110"></i>
					添加广告
				</button>

			</div>
			<form name="admin_list_sea" class="form-search" id="list-filter" method="post" action="{:url('admin/Plug/plug_ad_list')}">
				{if condition="config('lang_switch_on')"}
				<div class="col-xs-6 col-sm-2  margintop5">
					<select name="plug_ad_l" class="ajax_change">
						<option value="">按语言</option>
						<option value="zh-cn" {if condition="$plug_ad_l eq 'zh-cn'"}selected="selected"{/if}>中文</option>
						<option value="en-us" {if condition="$plug_ad_l eq 'en-us'"}selected="selected"{/if} >英语</option>
					</select>
				</div>
				{/if}
				<div class="col-xs-10 col-sm-4 margintop5">
					<div class="input-group">
										<span class="input-group-addon">
											<i class="ace-icon fa fa-check"></i>
										</span>
						<input type="text" name="key" id="key" class="form-control" value="{$val}" placeholder="输入广告名称" />
										<span class="input-group-btn">
											<button type="submit" class="btn btn-sm  btn-purple ajax-search-form">
												<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
												搜索
											</button>
										</span>
					</div>
				</div>
				<div class="col-xs-4 col-sm-3 margintop5">
					<div class="input-group-btn">
						<a href="{:url('admin/Plug/plug_ad_list')}">
							<button type="button" class="btn btn-sm  btn-purple ajax-display-all">
								<span class="ace-icon fa fa-globe icon-on-right bigger-110"></span>
								显示全部
							</button>
						</a>
					</div>
				</div>
			</form>
		</div>


		<div class="row">
			<div class="col-xs-12">
				<div>
					<form class="ajaxForm" name="plug_ad_allorder" method="post" action="{:url('admin/Plug/plug_ad_order')}" >
						<table class="table table-striped table-bordered table-hover" id="dynamic-table">
							<thead>
							<tr>
								<th class="hidden-xs">ID</th>
								<th>广告名称</th>
								<th class="hidden-sm hidden-xs">所属位置</th>
								{if condition="config('lang_switch_on')"}
								<th class="hidden-sm hidden-xs">语言</th>
								{/if}
								<th class="hidden-sm hidden-xs">添加时间</th>
								<th>排序</th>
								<th>状态</th>
								<th style="border-right:#CCC solid 1px;">操作</th>
							</tr>
							</thead>

							<tbody id="ajax-data">
								{include file="plug/ajax_plug_ad_list"/}
							</tbody>
						</table>
					</form>
				</div>
			</div>
		</div>


		<!-- 显示模态框（Modal） -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<form class="form-horizontal ajaxForm2" name="plug_ad_add" method="post" action="{:url('admin/Plug/plug_ad_runadd')}">
				<div class="modal-dialog" style="width:1000px;">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">×
							</button>
							<h4 class="modal-title" id="myModalLabel">
								添加广告
							</h4>
						</div>
						<div class="modal-body">


							<div class="row">
								<div class="col-xs-12">

									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 所属位置： </label>
										<div class="col-sm-11">
											<select name="plug_ad_adtypeid"  class="col-sm-4 selector" required>
												<option value="">请选择所属广告位</option>
												{foreach name="plug_adtype_list" item="v"}
													<option value="{$v.plug_adtype_id}">{$v.plug_adtype_name}</option>
												{/foreach}
											</select>
										</div>
									</div>
									{if condition="config('lang_switch_on')"}
									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 语言： </label>
										<div class="col-sm-11">
											<select name="plug_ad_l"  class="col-sm-4 selector" required>
												<option value="">请选择语言</option>
												<option value="zh-cn">中文</option>
												<option value="en-us">英语</option>
											</select>
										</div>
									</div>
									{/if}

									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 广告名称：  </label>
										<div class="col-sm-11">
											<input type="text" name="plug_ad_name" id="plug_ad_name" placeholder="输入广告名称" class="col-xs-10 col-sm-5" required/>
										</div>
									</div>

									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 广告模式： </label>
										<div class="col-sm-11">
											<div class="radio" >
												<label>
													<input name="plug_ad_checkid" id="plug_ad_checkid" checked type="radio" class="ace" value="1"/>
													<span class="lbl"> 图片模式</span>
												</label>
												<label>
													<input name="plug_ad_checkid" id="plug_ad_checkjsid" type="radio" class="ace" value="2"/>
													<span class="lbl"> JS代码</span>
												</label>
											</div>
										</div>
									</div>

									<div class="form-group" id="pic_jslist">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> JS代码：  </label>
										<div class="col-sm-11">
											<input type="text" name="plug_ad_js" id="plug_ad_js" placeholder="输入JS代码" class="col-xs-10 col-sm-8" />
										</div>
									</div>

									<div class="form-group" id="pic_list">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 广告图片： </label>
										<div class="col-sm-11">
											<a href="javascript:;" class="file">
												<input type="file" name="file0" id="file0" multiple="multiple"/>
												选择上传文件
											</a>
											<a href="javascript:;" onclick="return backpic('__PUBLIC__/img/no_img.jpg');" title="还原修改前的图片" class="file">
												撤销上传
											</a>

											<div><img src="__PUBLIC__/img/no_img.jpg" height="70" id="img0" ></div>
										</div>
									</div>

									<div class="form-group" id="pic_listurl">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 链接URL：  </label>
										<div class="col-sm-11">
											<input type="text" name="plug_ad_url" id="plug_ad_url" placeholder="输入链接URL" class="col-xs-10 col-sm-8" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>必须是以http://开头</span>
										</div>
									</div>

									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 是否审核： </label>
										<div class="col-sm-11" style="padding-top:5px;">
											<input name="plug_ad_open" id="plug_ad_open" value="1" class="ace ace-switch ace-switch-4 btn-flat" type="checkbox" />
											<span class="lbl">&nbsp;&nbsp;默认关闭</span>
										</div>
									</div>

									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 排序：  </label>
										<div class="col-sm-11">
											<input type="text" name="plug_ad_order" id="plug_ad_order" value="50" class="col-xs-10 col-sm-3" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>从小到大排序</span>
										</div>
									</div>

									<div class="form-group">
										<label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 内容： </label>
										<div class="col-sm-11">
											<textarea  name="plug_ad_content" cols="20" rows="2" class="col-xs-10 col-sm-8 limitedone" id="form-field-10"></textarea>
											<span class="lbl">&nbsp;&nbsp;广告文字内容</span>
										</div>
									</div>

								</div>
							</div>




						</div>
						<div class="modal-footer">
							<button type="submit" class="btn btn-primary">
								提交保存
							</button>
							<button class="btn btn-info" type="reset">
								重置
							</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">
								关闭
							</button>
						</div>
					</div><!-- /.modal-content -->
				</div><!-- /.modal-dialog -->
			</form>
		</div><!-- /.modal -->

	</div><!-- /.page-content -->
{/block}
{block name="scripts"}
	<script>
			$("#pic_jslist").hide();
			$("#plug_ad_checkjsid").click(function(){
				$("#pic_jslist").show();
				$("#pic_list").hide();
				$("#pic_listurl").hide();
			});

			$("#plug_ad_checkid").click(function(){
				$("#pic_jslist").hide();
				$("#pic_list").show();
				$("#pic_listurl").show();
			});
	</script>
{/block}
